package com.dl.aspect;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
// 切面类，类中的方法就是Advice（通知/增强）。
public class MyAspectAnnotation {
/*
    @Pointcut("execution(* com.dl.dao.*.*(..))")
    private void myPointCut(){}

    @Before("myPointCut()")
    public void myBefore(JoinPoint joinPoint){
        System.out.println("这是前置通知=>目标类是：" + joinPoint.getTarget()
                + ",被植入增强的目标方法是：" + joinPoint.getSignature().getName());
    }

*//*    @AfterReturning("myPointCut()")
    public void myAfterReturning(){
        System.out.println("这是后置通知");
    }*//*

*//*    @Around("myPointCut()")
    public Object myAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("环绕开始");
        Object object = proceedingJoinPoint.proceed();
        System.out.println("环绕结束");
        return object;
    }*//*

    @AfterThrowing(value = "myPointCut()", throwing = "e")
    public void myAfterThrowing(JoinPoint joinPoint, Throwable e){
        System.out.println("这是异常通知");
    }

*//*    @After("myPointCut()")
    public void myAfter(){
        System.out.println("这是最终通知");
    }*//*

    // 记录日志的增强。
    public void log(){
        System.out.println("模拟记录日志...");
    }*/
}
